package com.xiaozhen.auth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.client.RestTemplate;

/**
 * HISTORY
 *
 * @author zhenweisheng
 * @date 2021/8/5 15:37
 * @description:
 */
@EnableCaching
@SpringBootApplication
@EnableFeignClients
@EnableDiscoveryClient
@EnableAsync
public class Auth2Application {

    /**
     * 注入restTemplate
     * *@LoadBalanced 负载均衡,添加该注解后会去找注册中心查找url地址
     * *不加可以访问第三方服务 你也可以再单独注入一个
     *
     * @return
     */
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(Auth2Application.class, args);

    }

}

